//
//  TestClipImageViewController.m
//  MyDemos
//
//  Created by iMac on 2018/3/12.
//  Copyright © 2018年 iMac. All rights reserved.
//

#import "TestClipImageViewController.h"
#import "UIImage+Clip.h"
#import "WDImageUtils.h"
#import "UIButton+WDExtention.h"
#import "UIView+WDExtention.h"


@interface TestClipImageViewController ()


@end

@implementation TestClipImageViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    
    [self.view setBackgroundColor:[UIColor greenColor]];
    UIImage *image = [UIImage imageNamed:@"banner01.jpg"];
//    image = [WDImageUtils circleImage:image withParam:0];
//    image = [WDImageUtils imageWithColor:[UIColor blueColor] size:CGSizeMake(50, 50)];
//    image = [WDImageUtils circleImage:image withBorderWidth:300 borderColor:[UIColor blueColor]];
    image = [WDImageUtils imageClipToCircle:image targetImageShowSize:CGSizeMake(100, 100) withBorderWidth:10 borderColor:[UIColor whiteColor]];
    
    UIImageView *imageView = [[UIImageView alloc] init];
    imageView.backgroundColor = [UIColor yellowColor];
    imageView.frame = CGRectMake(100, 100, 100, 100);
    imageView.image = image;
    [self.view addSubview:imageView];
    
    
    
//    UIButton *btn = [UIButton new];
//    [btn setBackgroundImage:[WDImageUtils imageWithColor:[UIColor blueColor] size:CGSizeMake(1, 1)] forState:UIControlStateNormal];
//    [btn setFrame:CGRectMake(100, 200, 100, 100)];
//    [self.view addSubview:btn];

//    UIButton *btn = [[[[[[UIButton new] nomalTitle:@"标题" color:[UIColor redColor]] highlightedBGColorImage:[UIColor blueColor]] highlightedTitle:@"highlight标题" color:[UIColor greenColor]] highlightedBGColorImage:[UIColor yellowColor]] tap:^(UIButton * btn) {
//        NSLog(@"%ld", btn.tag);
//    }];
   
    UIButton *btn = Button().sNomalTitleColor(@"nomal title", [UIColor redColor])
    .sHighlightedTitleColor(@"highlighted title", [UIColor blueColor])
    .sFrame(CGRectMake(100, 200, 100, 100))
    .sNomalBGColorImage([UIColor yellowColor])
    .sHighlightedBGColorImage([UIColor purpleColor])
    .sTag(998);
    
    [btn tap:^(UIButton * sender) {
        NSLog(@"tag: %ld", sender.tag);
    }];
    [self.view addSubview:btn];
    
    UIView *view = View().sBGColor(kUIColorFromRGB(0xFF8053)).sFrame(CGRectMake(100, 300, 100, 100));
    [view tap:^(UIView *view) {
        NSLog(@"%@", view);
    }];
    [self.view addSubview:view];
    
    
//    [view addGestureRecognizer:]
}





@end
